package main
import (
	"fmt"
	"github.com/micro/go-micro"
	"golang.org/x/net/context"
	proto "my_micro/greeter"
)

type Greeter struct{}

func (g *Greeter) Hello(ctx context.Context, req *proto.HelloRequest, rsp *proto.HelloResponse) error {
	rsp.Greeting = "Hello " + req.Name
	return nil
}


func main(){
	service := micro.NewService(
                micro.Name("greeter"),
                micro.Version("latest"),
    )

    service.Init()
    proto.RegisterGreeterHandler(service.Server(), new(Greeter))

    if err := service.Run(); err != nil {
    	fmt.Println(err)
    }
}